\(\int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx\) [296]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (warning: unable to verify)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F(-2)]
   Giac [F(-2)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 74 \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=-\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{f}+\frac {\sqrt {a-b} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{f} \]

[Out]

-arctanh((a+b*tan(f*x+e)^2)^(1/2)/a^(1/2))*a^(1/2)/f+arctanh((a+b*tan(f*x+e)^2)^(1/2)/(a-b)^(1/2))*(a-b)^(1/2)
/f

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3751, 457, 85, 65, 214} \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\frac {\sqrt {a-b} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{f}-\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{f} \]

[In]

Int[Cot[e + f*x]*Sqrt[a + b*Tan[e + f*x]^2],x]

[Out]

-((Sqrt[a]*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[a]])/f) + (Sqrt[a - b]*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/S
qrt[a - b]])/f

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 85

Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[(b*e - a*f)/(b*c
- a*d), Int[(e + f*x)^(p - 1)/(a + b*x), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[(e + f*x)^(p - 1)/(c + d*x
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && LtQ[0, p, 1]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\sqrt {a+b x^2}}{x \left (1+x^2\right )} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \frac {\sqrt {a+b x}}{x (1+x)} \, dx,x,\tan ^2(e+f x)\right )}{2 f} \\ & = \frac {a \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\tan ^2(e+f x)\right )}{2 f}-\frac {(a-b) \text {Subst}\left (\int \frac {1}{(1+x) \sqrt {a+b x}} \, dx,x,\tan ^2(e+f x)\right )}{2 f} \\ & = \frac {a \text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \tan ^2(e+f x)}\right )}{b f}-\frac {(a-b) \text {Subst}\left (\int \frac {1}{1-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \tan ^2(e+f x)}\right )}{b f} \\ & = -\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )}{f}+\frac {\sqrt {a-b} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.97 \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\frac {-\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a}}\right )+\sqrt {a-b} \text {arctanh}\left (\frac {\sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )}{f} \]

[In]

Integrate[Cot[e + f*x]*Sqrt[a + b*Tan[e + f*x]^2],x]

[Out]

(-(Sqrt[a]*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[a]]) + Sqrt[a - b]*ArcTanh[Sqrt[a + b*Tan[e + f*x]^2]/Sqrt[
a - b]])/f

Maple [B] (warning: unable to verify)

Leaf count of result is larger than twice the leaf count of optimal. \(583\) vs. \(2(62)=124\).

Time = 1.06 (sec) , antiderivative size = 584, normalized size of antiderivative = 7.89

method result size
default \(-\frac {\sqrt {a +b \tan \left (f x +e \right )^{2}}\, \left (-2 \ln \left (4 \cos \left (f x +e \right ) \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}+4 \cos \left (f x +e \right ) a -4 b \cos \left (f x +e \right )+4 \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\right ) a^{\frac {3}{2}}+a \ln \left (-\frac {4 \left (\cos \left (f x +e \right ) \sqrt {a}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}+\cos \left (f x +e \right ) a -b \cos \left (f x +e \right )+\sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \sqrt {a}+b \right )}{\cos \left (f x +e \right )-1}\right ) \sqrt {a -b}+2 \ln \left (4 \cos \left (f x +e \right ) \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}+4 \cos \left (f x +e \right ) a -4 b \cos \left (f x +e \right )+4 \sqrt {a -b}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\right ) \sqrt {a}\, b -\ln \left (\frac {2 \cos \left (f x +e \right ) \sqrt {a}\, \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}+2 \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}\, \sqrt {a}-2 \cos \left (f x +e \right ) a +2 b \cos \left (f x +e \right )+2 b}{\sqrt {a}\, \left (\cos \left (f x +e \right )+1\right )}\right ) \sqrt {a -b}\, a \right ) \cos \left (f x +e \right )}{2 f \sqrt {a}\, \sqrt {a -b}\, \left (\cos \left (f x +e \right )+1\right ) \sqrt {\frac {a \cos \left (f x +e \right )^{2}-b \cos \left (f x +e \right )^{2}+b}{\left (\cos \left (f x +e \right )+1\right )^{2}}}}\) \(584\)

[In]

int(cot(f*x+e)*(a+b*tan(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/2/f/a^(1/2)/(a-b)^(1/2)*(a+b*tan(f*x+e)^2)^(1/2)*(-2*ln(4*cos(f*x+e)*(a-b)^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x
+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2)+4*cos(f*x+e)*a-4*b*cos(f*x+e)+4*(a-b)^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b
)/(cos(f*x+e)+1)^2)^(1/2))*a^(3/2)+a*ln(-4*(cos(f*x+e)*a^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+
1)^2)^(1/2)+cos(f*x+e)*a-b*cos(f*x+e)+((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2)*a^(1/2)+b)/(c
os(f*x+e)-1))*(a-b)^(1/2)+2*ln(4*cos(f*x+e)*(a-b)^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(
1/2)+4*cos(f*x+e)*a-4*b*cos(f*x+e)+4*(a-b)^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2))*a
^(1/2)*b-ln(2/a^(1/2)*(cos(f*x+e)*a^(1/2)*((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2)+((a*cos(f
*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2)*a^(1/2)-cos(f*x+e)*a+b*cos(f*x+e)+b)/(cos(f*x+e)+1))*(a-b)^(
1/2)*a)*cos(f*x+e)/(cos(f*x+e)+1)/((a*cos(f*x+e)^2-b*cos(f*x+e)^2+b)/(cos(f*x+e)+1)^2)^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 382, normalized size of antiderivative = 5.16 \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\left [\frac {\sqrt {a - b} \log \left (\frac {b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a - b} + 2 \, a - b}{\tan \left (f x + e\right )^{2} + 1}\right ) + \sqrt {a} \log \left (\frac {b \tan \left (f x + e\right )^{2} - 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a} + 2 \, a}{\tan \left (f x + e\right )^{2}}\right )}{2 \, f}, \frac {2 \, \sqrt {-a + b} \arctan \left (-\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a + b}}{a - b}\right ) + \sqrt {a} \log \left (\frac {b \tan \left (f x + e\right )^{2} - 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a} + 2 \, a}{\tan \left (f x + e\right )^{2}}\right )}{2 \, f}, \frac {2 \, \sqrt {-a} \arctan \left (\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a}}{a}\right ) + \sqrt {a - b} \log \left (\frac {b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {a - b} + 2 \, a - b}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f}, \frac {\sqrt {-a} \arctan \left (\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a}}{a}\right ) + \sqrt {-a + b} \arctan \left (-\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a + b}}{a - b}\right )}{f}\right ] \]

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/2*(sqrt(a - b)*log((b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a - b) + 2*a - b)/(tan(f*x + e)^2
+ 1)) + sqrt(a)*log((b*tan(f*x + e)^2 - 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a) + 2*a)/tan(f*x + e)^2))/f, 1/2*(2
*sqrt(-a + b)*arctan(-sqrt(b*tan(f*x + e)^2 + a)*sqrt(-a + b)/(a - b)) + sqrt(a)*log((b*tan(f*x + e)^2 - 2*sqr
t(b*tan(f*x + e)^2 + a)*sqrt(a) + 2*a)/tan(f*x + e)^2))/f, 1/2*(2*sqrt(-a)*arctan(sqrt(b*tan(f*x + e)^2 + a)*s
qrt(-a)/a) + sqrt(a - b)*log((b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(a - b) + 2*a - b)/(tan(f*x
+ e)^2 + 1)))/f, (sqrt(-a)*arctan(sqrt(b*tan(f*x + e)^2 + a)*sqrt(-a)/a) + sqrt(-a + b)*arctan(-sqrt(b*tan(f*x
 + e)^2 + a)*sqrt(-a + b)/(a - b)))/f]

Sympy [F]

\[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\int \sqrt {a + b \tan ^{2}{\left (e + f x \right )}} \cot {\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)**2)**(1/2),x)

[Out]

Integral(sqrt(a + b*tan(e + f*x)**2)*cot(e + f*x), x)

Maxima [F(-2)]

Exception generated. \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(b-a>0)', see `assume?` for mor
e details)Is

Giac [F(-2)]

Exception generated. \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Error: Bad Argument Type

Mupad [B] (verification not implemented)

Time = 0.31 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.12 \[ \int \cot (e+f x) \sqrt {a+b \tan ^2(e+f x)} \, dx=-\frac {\sqrt {a}\,\mathrm {atanh}\left (\frac {\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}}{\sqrt {a}}\right )}{f}-\frac {\mathrm {atanh}\left (\frac {a\,b^3\,\sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a}\,\sqrt {a-b}}{a\,b^4-a^2\,b^3}\right )\,\sqrt {a-b}}{f} \]

[In]

int(cot(e + f*x)*(a + b*tan(e + f*x)^2)^(1/2),x)

[Out]

- (a^(1/2)*atanh((a + b*tan(e + f*x)^2)^(1/2)/a^(1/2)))/f - (atanh((a*b^3*(a + b*tan(e + f*x)^2)^(1/2)*(a - b)
^(1/2))/(a*b^4 - a^2*b^3))*(a - b)^(1/2))/f